#ifndef _BUOLA_WIDGETS_CCOMBOBOX_H_
#define _BUOLA_WIDGETS_CCOMBOBOX_H_

#include <buola/widgets/clistwidget.h>
#include <buola/widgets/ceditbox.h>
#include <buola/utility/uevent.h>

namespace buola { namespace gui {

class CComboBox : public CListWidget
{
public:
    CComboBox();
    ~CComboBox();

    //! sets the caption to display for the box
    void SetCaption(const std::wstring &pCaption);
    
    //! returns the caption to display for the box
    const std::wstring &GetCaption()                {   return mEdit->GetCaption();        }
    
public:
    virtual void OnExpose(const CExposeEvent &pE);
    virtual void OnButtonDown(const CMouseEvent &pE);
    virtual void OnButtonUp(const CMouseEvent &pE);
    virtual void OnMouseMove(const CMouseEvent &pE);
    virtual void OnSize(const CGeometryEvent &pE);
    virtual void OnStyleChanged(TStyle);
    virtual void OnItemSelected(SItem*);

    void OnEditEnter(const std::wstring &pCaption);
    void OnListSelected(TID pID);

protected:
/////////////// protected functions //////////////
    void ShapeItem(int);

    void Update() {}

public:
    USignal<void(SItem*,TID)> sSelected;
    UEvent<void(std::wstring)> eEnter;

private:
    PListBox mList;
    PEditBox mEdit;

    img::PFont mFont;

    std::wstring mCaption;
};

/*namespace gui*/ } /*namespace buola*/ }

#endif
